package com.cssw.fyzb.wap.service;

import com.cssw.fyzb.base.web.domain.AjaxData;
import com.cssw.fyzb.base.web.domain.AjaxPage;
import com.cssw.fyzb.wap.model.vo.GExchangeFDefVo;
import com.cssw.fyzb.wap.model.vo.GExchangeFVo;
import com.cssw.fyzb.wap.model.vo.YExchangeFDefVo;
import com.ydn.appserver.MinaAppClient;
import com.ydn.appserver.Request;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ExchangeService extends BaseService {

    @Autowired
    private MinaAppClient busiClient;

    public AjaxData yExchangeF(long userId, Double num, Long yfId, Integer type, String pwd) {
        Request request = new Request("YExchangeF");
        request.setParameter("num", num);
        request.setParameter("userId", userId);
        request.setParameter("yfId", yfId);
        request.setParameter("type", type);
        request.setParameter("pwd", pwd);
        return convertData(busiClient.send(request));
    }

    public AjaxPage<YExchangeFDefVo> yExchangeFDefList() {
        Request request = new Request("YExchangeFDefList");
        return convertPage(busiClient.send(request), YExchangeFDefVo.class);
    }

    public AjaxData gExchangeF(long userId, Double num, Long logId, Integer type, String pwd) {
        Request request = new Request("GExchangeF");
        request.setParameter("num", num);
        request.setParameter("userId", userId);
        request.setParameter("logId", logId);
        request.setParameter("type", type);
        request.setParameter("pwd", pwd);
        return convertData(busiClient.send(request), GExchangeFVo.class);
    }

    public AjaxPage<GExchangeFDefVo> GExchangeFDefList() {
        Request request = new Request("GExchangeFDefList");
        return convertPage(busiClient.send(request), GExchangeFDefVo.class);
    }
}
